package com.guonl.controller;


import com.guonl.feign.OpenApiFeign;
import com.guonl.feign.auth.Auth;
import com.guonl.feign.model.UserInfo;
import com.guonl.model.ResponseResult;
import com.netflix.discovery.converters.Auto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;


@Tag(name = "OpenApiClientController")
@Slf4j
@RestController
@RequestMapping("/openapi/client")
public class OpenApiClientController {

    @Autowired
    private OpenApiFeign openApiFeign;

    private static final long apiKey = 12345678;

    @Operation(summary = "getTest1", description = "getTest1")
    @GetMapping("/getTest1")
    public ResponseResult getTest1(String name, Integer age, String phone) {

        return openApiFeign.getTest1(name, age, phone, apiKey);
    }

    @GetMapping("/getTest2")
    public ResponseResult getTest2(UserInfo userInfo) {
        return openApiFeign.getTest2(userInfo, apiKey);
    }

    @PostMapping("/postTest1")
    public ResponseResult postTest1(UserInfo userInfo) {
        return openApiFeign.postTest1(userInfo, apiKey);
    }

    @PostMapping("/postTest2")
    public ResponseResult postTest2(@RequestBody UserInfo userInfo) {
        return openApiFeign.postTest2(userInfo, apiKey);
    }


}
